// Copyright (c) MatrixFramework. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System;
using System.Threading;
using System.Threading.Tasks;
using MatrixFramework.Core.Results;
using MatrixFramework.Photos.Domain.Entities;

namespace MatrixFramework.Photos.Domain.Services;

/// <summary>
/// 照片处理服务接口
/// </summary>
public interface IPhotoProcessingService
{
    /// <summary>
    /// 处理照片
    /// </summary>
    /// <param name="photo">照片实体</param>
    /// <param name="cancellationToken">取消令牌</param>
    /// <returns>处理结果</returns>
    Task<Result<Photo>> ProcessPhotoAsync(Photo photo, CancellationToken cancellationToken = default);

    /// <summary>
    /// 提取照片元数据
    /// </summary>
    /// <param name="photo">照片实体</param>
    /// <param name="cancellationToken">取消令牌</param>
    /// <returns>元数据提取结果</returns>
    Task<Result<ValueObjects.PhotoMetadata>> ExtractMetadataAsync(Photo photo, CancellationToken cancellationToken = default);

    /// <summary>
    /// 生成缩略图
    /// </summary>
    /// <param name="photo">照片实体</param>
    /// <param name="size">缩略图尺寸</param>
    /// <param name="cancellationToken">取消令牌</param>
    /// <returns>缩略图URL结果</returns>
    Task<Result<string>> GenerateThumbnailAsync(Photo photo, int size, CancellationToken cancellationToken = default);

    /// <summary>
    /// 压缩照片
    /// </summary>
    /// <param name="photo">照片实体</param>
    /// <param name="quality">压缩质量</param>
    /// <param name="cancellationToken">取消令牌</param>
    /// <returns>压缩结果</returns>
    Task<Result<Photo>> CompressPhotoAsync(Photo photo, int quality = 85, CancellationToken cancellationToken = default);

    /// <summary>
    /// 验证照片文件
    /// </summary>
    /// <param name="photo">照片实体</param>
    /// <param name="cancellationToken">取消令牌</param>
    /// <returns>验证结果</returns>
    Task<Result<bool>> ValidatePhotoAsync(Photo photo, CancellationToken cancellationToken = default);
}